package org.dxy.domain.event.workorder;

import org.dxy.domain.event.AggregateTypeEnum;
import org.dxy.domain.event.DomainEvent;

/**
 * 工单正式关闭事件（包括质量确认等）
 * @author dxy
 * @createTime 2025/7/24 22:56
 */
public record WorkOrderClosedEvent(
    /** 工单ID */
    Long workOrderId,
    /** 工单编码 */
    String workOrderCode,
    /** 产品型号 */
    String productModel,
    /** 关闭原因 */
    String closeReason,
    /** 工单状态 */
    String workOrderStatus
) implements DomainEvent {
    
    @Override
    public Long aggregateId() {
        return workOrderId;
    }
    
    @Override
    public String aggregateType() {
        return AggregateTypeEnum.WORK_ORDER.getKey();
    }
    
    @Override
    public String eventType() {
        return WorkOrderEventTypeEnum.CLOSED.getKey();
    }
    
    /**
     * 获取工单事件类型枚举
     */
    public WorkOrderEventTypeEnum getWorkOrderEventType() {
        return WorkOrderEventTypeEnum.CLOSED;
    }
}